home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / CustomSolutionWizard_Files / Demo / Train.bas < prev    next >
Encoding:
BASIC Source File  |  2002-03-08  |  1.1 KB  |  40 lines

  1. Sub Train()
  2.     
  3.     'Define the exclusive-or input data
  4.     Dim InputData(0 To 1, 0 To 3)  As Variant
  5.     InputData(0, 0) = 0!
  6.     InputData(0, 1) = 0!
  7.     InputData(0, 2) = 1!
  8.     InputData(0, 3) = 1!
  9.     InputData(1, 0) = 0!
  10.     InputData(1, 1) = 1!
  11.     InputData(1, 2) = 0!
  12.     InputData(1, 3) = 1!
  13.     
  14.     'Define the exclusive-or desired data
  15.     Dim DesiredData(0 To 0, 0 To 3) As Variant
  16.     DesiredData(0, 0) = 0!
  17.     DesiredData(0, 1) = 1!
  18.     DesiredData(0, 2) = 1!
  19.     DesiredData(0, 3) = 0!
  20.     
  21.     'Create a learning network object
  22.     Dim nn As New NSLearningNetwork
  23.     
  24.     'Set the path to the generated neural network DLL
  25.     nn.dllPathName = g_CSWPath + "\Demo\DemoMLP.dll"
  26.     
  27.     'Send the input data to the neural network DLL
  28.     nn.InputData = InputData
  29.     
  30.     'Send the desired data to the neural network DLL
  31.     nn.DesiredData = DesiredData
  32.     
  33.     'Train the neural network for the specified number of epochs
  34.     nn.Train EpochsTextBox.Text
  35.     
  36.     'Display the best training cost
  37.     BestCostTextBox.Text = Format(nn.bestCost, "0.000000")
  38.     BestCostTextBox.Refresh
  39.     
  40. End Sub